/**
 * Caution: Consider this file when using react-scripts
 * 
 * You may delete this file and its occurrences from the project filesystem if you are using GatsbyJS or NextJS version
 */
import React from 'react';
import { Router } from 'react-router-dom';
import { createBrowserHistory } from 'history';
import Routes from './Routes';

import { Provider } from 'react-redux'
import { persistStore } from 'redux-persist'
import { PersistGate } from 'redux-persist/integration/react'
import { useStore } from 'redux/store'

import 'react-lazy-load-image-component/src/effects/opacity.css';
import 'leaflet/dist/leaflet.css';
import 'assets/css/index.css';

// import 'swiper/css/swiper.min.css';
import "swiper/swiper.css";
import "swiper/swiper.min.css";

import 'aos/dist/aos.css';

const browserHistory = createBrowserHistory();
require('dotenv').config()
  
const App = () => {
  const store = useStore({})
  const persistor = persistStore(store, {}, function () {
      persistor.persist()
  })

  return (
    <Provider store={store}>
      <PersistGate loading={<div>loading</div>} persistor={persistor}>
        <Router history={browserHistory}>
          <Routes />
        </Router>
      </PersistGate>
    </Provider>
  );
}

export default App;